package com.yy.permissions_general.common.config.mail;

import cn.hutool.extra.mail.MailAccount;
import com.yy.permissions_general.common.constant.MailConstant;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.nio.charset.StandardCharsets;

/**
 * @ClassName MailConfig
 * @Description: TODO 邮件配置
 * @Author YangYI
 * @Date 2022/2/10
 * @Version V1.0
 **/
@Configuration
public class MailConfig {
    @Bean
    public MailAccount mailAccount() {
        MailAccount mailAccount = new MailAccount();
        mailAccount.setHost(MailConstant.MAIN_HOST);
        mailAccount.setPort(MailConstant.MAIN_PORT);
        mailAccount.setFrom(MailConstant.MAIN_FROM);
        mailAccount.setUser(MailConstant.MAIN_USER);
        mailAccount.setPass(MailConstant.MAIN_PASS);
        mailAccount.setCharset(StandardCharsets.UTF_8);
        mailAccount.setAuth(true);
        return mailAccount;
    }
}
